//
//  RulerViewController.swift
//  SwitfTest
//
//  Created by runone02 on 2019/1/11.
//  Copyright © 2019年 liqiyun. All rights reserved.
//

import UIKit

class RulerViewController: BaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
      self.title = "显示内容"
      view.backgroundColor = UIColor.white
      addView()
    }
    
    func addView(){
        let rulerV = rulerView()
        rulerV.backgroundColor = UIColor.red
        rulerV.isSingle = false
        rulerV.maxSelectedCount = 7
        
        view.addSubview(rulerV)
        rulerV.mas_makeConstraints { (make) in
            make?.top.mas_equalTo()(view)?.offset()(kTopBarHeight)
            make?.left.mas_equalTo()(view)?.offset()(20)
            make?.right.mas_equalTo()(view)?.offset()(-20)
            make?.height.mas_equalTo()(SCREEN_HEIGHT)
        }
        
        rulerV.frameUpDate = {(viewHeight : CGFloat) -> Void in
        
            //更改rulerV的约束
//            rulerV.frame = CGRect(x: 20, y: 100, width: SCREEN_WIDTH - 40, height: viewHeight)
//            rulerV.mas_updateConstraints({ (make) in
//                make?.top.mas_equalTo()(self.view)?.offset()(100)
//                make?.left.mas_equalTo()(self.view)?.offset()(20)
//                make?.right.mas_equalTo()(self.view)?.offset()(-20)
//                make?.height.mas_equalTo()(viewHeight)
//            })
        }
        
        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.5) {
            rulerV.setDataForView(data: ["qwewq", "针的是很烦","一份","还SARAQDWA", "针的是很烦","针的是很烦", "针的", "针的是", "哈哈哈我去额", "哈","不会煮", "哈哈", "ewoiqeuwqo","CGFAE", "wqeoqwei","qwopp[dkklj", "qewoied", "撒谎大会开始","打时空大胜靠德","怎么做","到这样的"])
    }
    
        //选择的状态回调
        rulerV.selectedItemCallBack = {(itemArr : [UIButton],  itemSelectedArr : [Bool] , sender :  UIButton) -> Void in
           
        }
  }
    
}
